-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QNN] Concat - Refactoring to C++ #3819
Conversation
41c82e4
to
6b35322
Compare
ea98355
to
5679038
Compare
@vinx13 @zhiics @yzhliu Can you please review this? Refactoring to C++ removes InferType dependency. Relevant comment - #3730 (comment) |
src/relay/pass/pattern_util.h
Outdated
@@ -415,6 +415,13 @@ static inline Expr Full(Expr fill_value, | |||
return CallNode::make(op, {fill_value}, Attrs(attrs), {}); | |||
} | |||
|
|||
static inline Expr Concatenate(Expr data, int axis) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually the same as MakeConcatenate
below isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Nice observation. Made the changes to use that.
5679038
to
b1e43d2
Compare
src/relay/qnn/op/concatenate.cc
Outdated
Array<tvm::Expr> input_zero_points, double output_scale, | ||
int32_t output_zero_point, int axis) { | ||
auto attrs = make_node<QnnConcatenateAttrs>(); | ||
attrs->input_scales = input_scales; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attrs->input_scales = input_scales; | |
attrs->input_scales = std::move(input_scales); |
src/relay/qnn/op/concatenate.cc
Outdated
int32_t output_zero_point, int axis) { | ||
auto attrs = make_node<QnnConcatenateAttrs>(); | ||
attrs->input_scales = input_scales; | ||
attrs->input_zero_points = input_zero_points; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attrs->input_zero_points = input_zero_points; | |
attrs->input_zero_points = std::move(input_zero_points); |
src/relay/qnn/op/concatenate.cc
Outdated
|
||
/* | ||
* \brief Canonicalizes the QNN concatenate op. | ||
* \param ref_call The original call that will be lowered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names in comment mismatch with the arguments.
src/relay/qnn/util.h
Outdated
const Array<IndexExpr>& input_shape, const DataType& out_dtype); | ||
|
||
static inline Expr Requantize(const Expr& data, const Array<IndexExpr>& input_shape, | ||
const double& input_scale, const int32_t& input_zero_point, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to have const xx&
for built-in types, just double input_scale
, int32_t input_zero_point
etc.
b1e43d2
to
cc55ce8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There are 2 reasons for moving to C++
Please review @yzhliu @jackwish @FrozenGene @vinx13 @tqchen @zhiics